<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp"%>
<style>
</style>
<script type="text/javascript">
    $(function() {
    	$('#codeDataEdit_category').val('${codeData.category}');
    	$('#codeDataEdit_category').change(function(){
    		var text=$('#codeDataEdit_category option:selected').text();
    		$('#codeDataEdit_categoryName').val(text);
    	})
        $('#codeDataEditForm').form({
            url : '${path}/code/codeData/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    showMsg(result.msg);
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#codeDataEditForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
    })
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title=""
		style="overflow-x: hidden; overflow-y: auto; padding: 3px;">
		<form id="codeDataEditForm" method="post">
			<table class="grid">
				<tr>
					<td>编码</td>
					<td><input type="hidden" name="id" value="${codeData.id}">
						<input name='code' id='code' type='text' placeholder='请输入编码'
						class='easyui-text easyui-validatebox span2'
						data-options='required:true' value='${codeData.code}'></td>
					<td>名称</td>
					<td>
					<input name='name' id='name' type='text'
						placeholder='请输入名称' class='easyui-text easyui-validatebox span2'
						data-options='required:true' value='${codeData.name}'></td>
				</tr>
				<tr>
					<td>类别</td>
					<td colspan="3">
					<select name='category' id="codeDataEdit_category" class='easyui-text  span2 easyui-validatebox span2'  data-options='required:true'>
                        	<option value="">-请选择-</option>
                        	<c:if test="${codeCategoryList.size()>0}">
                        		<c:forEach var="codeCategory" items="${codeCategoryList}">
                        		 <option value="${codeCategory.category}">${codeCategory.categoryName}</option>
                        		</c:forEach>
                        	</c:if>
                        </select>
					<input name='categoryName' type="hidden" id="codeDataEdit_categoryName" value='${codeData.categoryName}'>
					</td>
				</tr>
				<tr>
					<td>备注</td>
					<td colspan="3"><textarea name='remark' id='remark'
							style='border-radius: 5px; min-height: 50px; min-width: 300px;'
							class='easyui-text'>${codeData.remark}</textarea></td>
				</tr>
			</table>
		</form>
	</div>
</div>